.PHONY:sim list build vcs verdi cov dve clean

#-------------------------------------------------------------------------------------------------------
sim  :  vcs verdi 
#-------------------------------------------------------------------------------------------------------
COV_DIR = cov_rpt
LD_LIBRARY_PATH = ${VERDI_HOME}/share/PLI/VCS/LINUX64
VCS_FLAG :=     -f filelist.f  \
    -timescale=1ns/1ps +memcbk \
    -fsdb -full64  -R -j8  +vc  +libext+.sv+.v +v2k -sverilog  \
    -debug_access+all -kdb -lca \
	-cm line+cond+fsm+tgl	-cm_dir ${COV_DIR} \
	-P ${LD_LIBRARY_PATH}/novas.tab  ${LD_LIBRARY_PATH}/pli.a  \
	|  tee  vcs.log



list:
	find $(abspath ./src) $(abspath ./sim) -name "*.v" -or -name "*.sv"  > filelist.f
	find $(abspath ./src) -name "*.v" -or -name "*.sv" > ./syn/filelist_syn.f


vcs   :list
	vcs  $(VCS_FLAG) 

#-------------------------------------------------------------------------------------------------------
verdi  :
	 verdi -sv -f filelist.f   -nologo -ssf tb.fsdb &
#-------------------------------------------------------------------------------------------------------

#show the coverage,must all finish
cov	:vcs
	dve -full64 -covdir *.vdb &
#-------------------------------------------------------------------------------------------------------
dve:
	./simv -gui  &	
#	dve -vpd vcdplus.vpd &  

#-------------------------------------------------------------------------------------------------------
syn:list
	$(shell mkdir -p syn/work syn/mapped syn/report syn/unmapped )
	@cd syn/work && dc_shell -f ../scripts/SynFlow.tcl  -output_log_file ../log/top_syn.log
#-------------------------------------------------------------------------------------------------------
clean  :
	 rm  -rf  *~  filelist.f core syn/*.f syn/*.log syn/work syn/mapped syn/unmapped syn/report csrc  simv*  vc_hdrs.h  ucli.key  urg* *.log  novas.* *.fsdb* verdiLog  64* DVEfiles *.vpd *vdb
#-------------------------------------------------------------------------------------------------------
